<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>My Project: kern/sync/sync.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_b3dad8e81b3f37b89b2bf0a8abb2d993.html">kern</a></li><li class="navelem"><a class="el" href="dir_836f16519ec1e97f90c9de728e1b7748.html">sync</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">sync.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="sync_8h.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef __KERN_SYNC_SYNC_H__</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define __KERN_SYNC_SYNC_H__</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160; </div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="intr_8h.html">intr.h</a>&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="mmu_8h.html">mmu.h</a>&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="riscv_8h.html">riscv.h</a>&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160; </div>
<div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="sync_8h.html#aedabe054445606bdb2892a827d55bdc1">    8</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="sync_8h.html#aedabe054445606bdb2892a827d55bdc1">__intr_save</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;    <span class="keywordflow">if</span> (read_csr(sstatus) &amp; <a class="code" href="riscv_8h.html#a1c1f1da0ecfca5bc4fc4db3acadf1bc8">SSTATUS_SIE</a>) {</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;        <a class="code" href="intr_8c.html#a51ef818cc1ceed4340d088bb16277653">intr_disable</a>();</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;        <span class="keywordflow">return</span> 1;</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;    }</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;}</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="sync_8h.html#a032faaaf34bfa59be75332ff7334801a">   16</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="sync_8h.html#a032faaaf34bfa59be75332ff7334801a">__intr_restore</a>(<span class="keywordtype">bool</span> flag) {</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <span class="keywordflow">if</span> (flag) {</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;        <a class="code" href="intr_8c.html#af81ea364a876a1339329bc24fa5eaafb">intr_enable</a>();</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    }</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;}</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="sync_8h.html#a81a5ec049b2b47d1e7d67d31a328d89d">   22</a></span>&#160;<span class="preprocessor">#define local_intr_save(x) \</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">    do {                   \</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">        x = __intr_save(); \</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">    } while (0)</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="sync_8h.html#ab7f325a8ea05b4e7bc89b015fd35c0ac">   27</a></span>&#160;<span class="preprocessor">#define local_intr_restore(x) __intr_restore(x);</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* !__KERN_SYNC_SYNC_H__ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="aintr_8c_html_a51ef818cc1ceed4340d088bb16277653"><div class="ttname"><a href="intr_8c.html#a51ef818cc1ceed4340d088bb16277653">intr_disable</a></div><div class="ttdeci">void intr_disable(void)</div><div class="ttdef"><b>Definition:</b> intr.c:8</div></div>
<div class="ttc" id="aintr_8c_html_af81ea364a876a1339329bc24fa5eaafb"><div class="ttname"><a href="intr_8c.html#af81ea364a876a1339329bc24fa5eaafb">intr_enable</a></div><div class="ttdeci">void intr_enable(void)</div><div class="ttdef"><b>Definition:</b> intr.c:5</div></div>
<div class="ttc" id="aintr_8h_html"><div class="ttname"><a href="intr_8h.html">intr.h</a></div></div>
<div class="ttc" id="ammu_8h_html"><div class="ttname"><a href="mmu_8h.html">mmu.h</a></div></div>
<div class="ttc" id="ariscv_8h_html"><div class="ttname"><a href="riscv_8h.html">riscv.h</a></div></div>
<div class="ttc" id="ariscv_8h_html_a1c1f1da0ecfca5bc4fc4db3acadf1bc8"><div class="ttname"><a href="riscv_8h.html#a1c1f1da0ecfca5bc4fc4db3acadf1bc8">SSTATUS_SIE</a></div><div class="ttdeci">#define SSTATUS_SIE</div><div class="ttdef"><b>Definition:</b> riscv.h:46</div></div>
<div class="ttc" id="async_8h_html_a032faaaf34bfa59be75332ff7334801a"><div class="ttname"><a href="sync_8h.html#a032faaaf34bfa59be75332ff7334801a">__intr_restore</a></div><div class="ttdeci">static void __intr_restore(bool flag)</div><div class="ttdef"><b>Definition:</b> sync.h:16</div></div>
<div class="ttc" id="async_8h_html_aedabe054445606bdb2892a827d55bdc1"><div class="ttname"><a href="sync_8h.html#aedabe054445606bdb2892a827d55bdc1">__intr_save</a></div><div class="ttdeci">static bool __intr_save(void)</div><div class="ttdef"><b>Definition:</b> sync.h:8</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
